#pragma once
#include "interfaces.h"
#include "Mesh.h"
#include "REString.h"
#include "AssetData.h"
#include "AssetParsers.h"
#include "RandomEngine.h"

class AssetManager : public IAssetManager
{
public:
	AssetManager();
	~AssetManager();

	AssetDataList * GetAssetData(Resource &res);
	AssetDataPtr GetAssetData(const std::string & node_name);
	AssetDataPtr GetAssetData(const RE_String & node_name);
private:
	//-----------------------------------------------------------------------------------------------------------------
	//Asset Managment
	//-----------------------------------------------------------------------------------------------------------------
	AssetDataList * FindAssets(Resource &res);
	AssetDataList * LoadAssets(Resource &res);
	bool RemoveAssets(Resource &res);

	//-----------------------------------------------------------------------------------------------------------------
	//AssetMap Mangment
	//-----------------------------------------------------------------------------------------------------------------
public:
	void AddAsset(Resource & res, AssetDataList * assets);
	//void RemoveAssets(Resource &res);
	void RestoreAssets();
	void ReleaseAssets(const bool OnlyBuffers = true);
private:
	//-----------------------------------------------------------------------------------------------------------------
	//Parser Managment
	//-----------------------------------------------------------------------------------------------------------------
	void AddParser(std::string & format, AssetParserPtr ptr);
	void RemoveParser(AssetParserPtr);
	void RemoveParser(std::string & format);

	//-----------------------------------------------------------------------------------------------------------------
	//Variabls
	//-----------------------------------------------------------------------------------------------------------------
	ResourceMap m_ResourceMap;
	AssetNameMap m_AssetNameMap;
	ParserMap	m_ParserMap;
};





